package com.yunhai.support.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.support.entity.PhoneVoiceMessage;
import com.yunhai.support.entity.vo.VoiceMessageVo;
import com.yunhai.support.service.AliVoiceMessageService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/alimenssage")
public class AliVoiceMessageController {

    @Resource
    private AliVoiceMessageService aliVoiceMessageService;

    /**
     * 获取短信分页列表
     * */
    @GetMapping("/_voice/pagination")
    public Ret getVoiceMessagePagination(PaginationVo paginationVo, VoiceMessageVo voiceMessageVo) throws Exception {

        IPage page = aliVoiceMessageService.getVoiceMessagePagination(paginationVo, voiceMessageVo);
        return Ret.toPage(page);
    }

    /**
     * 获取所有短信
     * */
    @GetMapping("/_voice/list")
    public Ret getVoiceMessageList() throws Exception {

        List<PhoneVoiceMessage> voiceMessageList = aliVoiceMessageService.getVoiceMessageList();
        return Ret.ok(voiceMessageList);
    }
}
